home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 36 / Issue 36.iso / pc / iwks / Wap / NokiaToolkit2_0 / setup.exe / Disk1 / data1.cab / Sample_Files / getCapital.wmls < prev    next >
Encoding:
Text File  |  2000-06-19  |  960 b   |  43 lines

  1. /*
  2.  * Given a country name and a variable, put the
  3.  * country's capital in the variable.
  4.  *@param capital the variable name in which to store the capital
  5.  *@param country the country name
  6.  */
  7. extern function getCapital(capital, country)
  8. {
  9.     var returnCapital="Unknown ...";
  10.  
  11.     if ("Denmark" == country) {
  12.         returnCapital = "Copenhagen";
  13.     }
  14.     else if ("Finland" == country) {
  15.         returnCapital = "Helsinki";
  16.     }
  17.     else if ("Norway" == country) {
  18.         returnCapital = "Oslo";
  19.     }
  20.     else if ("Sweden" == country) {
  21.         returnCapital = "Stockholm";
  22.     }
  23.     else if ("Germany" == country) {
  24.         returnCapital = "Berlin";
  25.     }
  26.     else if ("France" == country) {
  27.         returnCapital = "Paris";
  28.     }
  29.     else if ("Spain" == country) {
  30.         returnCapital = "Madrid";
  31.     }
  32.     else if ("Italy" == country) {
  33.         returnCapital = "Rome";
  34.     }
  35.  
  36.     WMLBrowser.setVar(capital, returnCapital);
  37.  
  38.     /*
  39.       * Make sure the browser updates its display.
  40.      */
  41.     WMLBrowser.refresh();
  42. };
  43.